
class character {
    name:string;
    constructor(name:string){
        this.name=name;
    }
    say() {
        console.log("233");
    }
}

export class wukong extends character {
    collition: Phaser.Types.Physics.Arcade.SpriteWithDynamicBody;
    scece:any;
    constructor(scene: Phaser.Scene, x: number, y: number, ground: any) {
        super("wukong");
        this.collition = scene.physics.add.sprite(0, 0, "wukong", "站1.png");;
        this.collition.setBounce(0.2);
        this.collition.body.setGravityY(300);
        this.scece=scene;
        scene.physics.add.collider(this.collition, ground);
    }
    stand() {
        this.collition.anims.play(`${this.name}/stand`);
    }
    walk() {
        this.collition.anims.play(`${this.name}/walk`);
    }

    beginsayhi() {
        this.scece.events.addListener("update", this.sayhi);
    }
    stopsayhi(){
        this.scece.events.removeListener("update", this.sayhi);
    }

    sayhi(){
        console.log("HI!");
        
    }
}

export class pang extends character {
    constructor() {
        super("pang");
    }
}
export class jiaotou extends character {
    constructor() {
        super("jiaotou");
    }
}


